package com.gszy.auth.dao;

import com.gszy.auth.database.BeanListHandler;
import com.gszy.auth.database.JdbcTemplate;
import com.gszy.auth.entity.Permission;

import java.util.List;

public class PermissionDao {

    public List<Permission> findPermissionByRoleId(String roleId){

        String sql = "select * from permission where id in"+
                "select permission_id from role_permission where role_id=?";

        return new JdbcTemplate()
                .queryForList(sql
                ,new BeanListHandler<>(Permission.class),
                        roleId);
    }
}
